package com.buka.config;

import org.bouncycastle.asn1.cmp.KeyRecRepContent;
import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

@Configuration
public class LimitConfig {

    @Bean
    public KeyResolver pathKeyResolver() {
       return new KeyResolver() {
           @Override
           public Mono<String> resolve(ServerWebExchange exchange) {
               return Mono.just(exchange.getRequest().getPath().value());
           }
       };
    }
}
